def str_is_blank(s):
    """
    校验字符串是否为空
    :param s:
    :return:
    """
    if s is None or s.strip() == "":
        return True
    else:
        return False


def file_suffix(filename):
    """获取文件后缀名"""
    if str_is_blank(filename):
        return ""
    else:
        return filename.split(".")[-1]


def file_is_img(filetype):
    """判断文件是否为图片"""
    if str_is_blank(filetype):
        return False
    rules = ["jpg", "jpeg", "png", "gif", "bmp", "octet-stream"]
    for suffix in rules:
        if suffix == filetype:
            return True
    return False
